package com.lcf.annotation;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * Created by Administrator on 2019/4/29.
 */
public class TestAnno {

    @AopAnnotation(name = "Alice", age = 21, arr = {"12", "aa"})
    public void add() {

    }

    public void del() {

    }

    public static void main(String[] args) throws ClassNotFoundException {
        Class<?> clazz = Class.forName("com.lcf.annotation.TestAnno");
        Method[] methods = clazz.getDeclaredMethods();

        for (Method method : methods) {
            System.out.println("获取所有的方法------>" + method);
            AopAnnotation annotation = method.getAnnotation(AopAnnotation.class);
            if (null == annotation) {
                continue;
            }
            System.out.println("age: " + annotation.age());
            System.out.println("name: " + annotation.name());
            System.out.println("数组：" + Arrays.toString(annotation.arr()));
        }
    }
}
